package com.utils;

import redis.clients.jedis.Jedis;

import javax.servlet.http.HttpServletRequest;

public class UserUtil {

    public static Integer getUserId(HttpServletRequest request) {
        String token = request.getHeader("token");
        try (Jedis jedis = new Jedis("47.106.226.199", 6429)) {
            jedis.auth("666t01");
            if (jedis.get(token) != null) {
                return Integer.parseInt(jedis.get(token));
            }
        }
        return null;
    }


}
